﻿@using North.Common
@using North.Core.Common;
@using North.Core.Entities
@using North.RCL.Texts
@using North.RCL.ToolBars
@using SqlSugar

@inherits LayoutComponentBase

@inject IJSRuntime JS
@inject ILogger _logger
@inject ISqlSugarClient _client
@inject NavigationManager _nav
@inject IHttpContextAccessor _accessor
@inject AppSetting _appSetting

<MudStack Spacing="0" Style="height:50px;">
    <ActionToolBar IsExpanded="@IsExpanded" DarkTheme="@DarkTheme" Title="@_appSetting.Appearance.Name"
                   OnNavMenuStateChanged="(() => IsExpanded = !IsExpanded)" OnSwitchTheme="@SwitchTheme" OnUserClick="@(() => SignOut())" />
    <MudDivider />
</MudStack>
<MudStack Row Spacing="0" Style="position: absolute; top: 50px; bottom: 0; left: 0; right:0;">
    <NavMenu IsExpanded="@IsExpanded" OpenMiniOnHover="_appSetting.Appearance.NavAutoExpand" Style="width:240px;" />
    <MudStack Spacing="0" Class="mud-height-full mud-width-full">
        @if (string.IsNullOrWhiteSpace(_appSetting.Appearance.Footer))
        {
            @Body
        }
        else
        {
            <MudStack Class="mud-width-full" Style="height:calc(100% - 40px);">
                @Body
            </MudStack>
            <FooterText Content="@_appSetting.Appearance.Footer" Style="height:40px; text-align:center;" />
        }
    </MudStack>
</MudStack>